<!DOCTYPE html>
<html lang="en">
<head xmlns:th="http://www.thymeleaf.org">
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <script src="/js/jquery-3.7.1.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container-fluid">
    <h1 style="position: relative; left: 650px;">学生信息处理系统</h1>
    <!-- Button trigger modal -->
    <button type="button" class="btn btn-default btn-lg" onclick="loadTable()">
        显示所有学生信息
    </button>
    <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
        新增学生
    </button>
    <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#searchModal">
        查找学生
    </button>
    <br><br>
    <table class="table table-hover">
        <thead>
        <tr>
            <th>#<svg onclick="sortTable('id');" style="width: 15px; height: 15px; position: relative; left: 10px; top: 2px; cursor: pointer;" t="1715780024363" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4243" width="200" height="200"><path d="M662.5 179.025l165.123 154.066c14.133 13.187 36.28 12.42 49.468-1.714 13.187-14.133 12.42-36.28-1.714-49.468l-224-209C629.003 52.033 592.5 67.9 592.5 98.5V923c0 19.33 15.67 35 35 35s35-15.67 35-35V179.025zM352.5 841.906L187.377 687.84c-14.133-13.187-36.28-12.42-49.468 1.714-13.187 14.133-12.42 36.28 1.714 49.467l224 209c22.374 20.876 58.877 5.01 58.877-25.59V97.93c0-19.33-15.67-35-35-35s-35 15.67-35 35v743.975z" fill="#2F54EB" p-id="4244"></path></svg></th>
            <th>学号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>所选课程号</th>
            <th>成绩</th>
            <th style="width: 100px;">操作</th>
        </tr>
        </thead>
        <tbody id="studentTb">
        </tbody>
    </table>
    <!-- 表格分页 -->
    <nav aria-label="Page navigation" style="position: relative; left: 1350px; bottom: 30px;" id="page">
        <ul class="pagination" id="pagination">
            <!-- 分页链接将在此动态插入 -->
        </ul>
    </nav>
    <div class="form-group">
        <label for="courseSelect">查询选课信息</label>
        <select class="form-control" id="courseSelect" onchange="getStudentsByCourse()">
            <option value="">选择课程</option>
            <option value="2001">数据库</option>
            <option value="2002">高数</option>
            <option value="2003">操作系统</option>
            <option value="2004">计算机网络</option>
            <option value="2005">Web开发</option>
            <option value="2006">数据结构</option>
        </select>
    </div>
</div>
<!--学生信息模态框-->
<div class="modal fade" tabindex="-1" role="dialog" id="myModal">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">学生信息</h4>
            </div>
            <div class="modal-body">
                <form id="studentForm">
                    <div class="form-group" id="editId" style="display: none;">
                        <label for="id">编号</label>
                        <input type="text" class="form-control" id="id" name="id" placeholder="编号" readonly>
                    </div>
                    <div class="form-group">
                        <label for="no">学号</label>
                        <input type="text" class="form-control" id="no" name="no" placeholder="学号">
                    </div>
                    <div class="form-group">
                        <label for="name">姓名</label>
                        <input type="text" class="form-control" id="name" name="name" placeholder="姓名">
                    </div>
                    <div class="form-group">
                        <label for="sex">性别</label>
                        <select class="form-control" id="sex" name="sex">
                            <option value="1">男</option>
                            <option value="2">女</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="cno">所选课程号</label>
                        <select class="form-control" id="cno" name="cno">
                            <option value="2001">数据库</option>
                            <option value="2002">高数</option>
                            <option value="2003">操作系统</option>
                            <option value="2004">计算机网络</option>
                            <option value="2005">Web开发</option>
                            <option value="2006">数据结构</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="score">成绩</label>
                        <input type="text" class="form-control" id="score" name="score" placeholder="成绩">
                    </div>
                </form>
                <!--                表单结束-->
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" id="saveButton" onclick="addStudent();" >保存</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- 查询模态框 -->
<div class="modal fade" id="searchModal" tabindex="-1" role="dialog" aria-labelledby="searchModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="searchModalLabel">查询学生信息</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <div class="form-group">
                    <label for="searchBy">选择查询方式：</label>
                    <select class="form-control" id="searchBy">
                        <option value="id">ID</option>
                        <option value="no">学号</option>
                        <option value="name">姓名</option>
                    </select>
                </div>
                <div class="form-group">
                    <label for="searchInput">输入查询关键词：</label>
                    <input type="text" class="form-control" id="searchInput" placeholder="请输入查询关键词">
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="searchStudent()">查询</button>
            </div>
        </div>
    </div>
</div>
<script src="/pagejs/student/list.js"></script>
</body>
</html>